/* Appendix Table C3*/

use "Raw Data/journalist_survey.dta", clear

merge m:1 state_name pc_num using "Analysis Data/PC_est_sample.dta", keep(matched) nogen
merge m:1 state_name pc_num using "Raw Data/ECI_sched_clean.dta", keep(matched) keepusing(poll_date) nogen

tab medium_coded, gen(medium_coded_)

recode language_coded (1 2 9 = 10)
tab language_coded, gen(language_coded_)

recode gender_coded (1=0) (2=1)
recode religion_coded (2 3 = 0)

egen pc_id = group(state_name pc_num)

gen UPA_votebuyer = (secret_1=="UPA"|secret_2=="UPA"|secret_3=="UPA")
gen NDA_votebuyer = (secret_1=="NDA"|secret_2=="NDA"|secret_3=="NDA")

*Table C1
eststo clear
eststo: reg UPA_votebuyer gender_coded religion_coded medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode)
eststo: areg UPA_votebuyer gender_coded religion_coded medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode) absorb(poll_date)
eststo: areg UPA_votebuyer gender_coded religion_coded  medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode) absorb(pc_id)

eststo: reg NDA_votebuyer gender_coded religion_coded  medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode)
eststo: areg NDA_votebuyer gender_coded religion_coded  medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode) absorb(poll_date)
eststo: areg NDA_votebuyer gender_coded religion_coded  medium_coded_1-medium_coded_2 language_coded_1-language_coded_6, cluster(jcode) absorb(pc_id)

esttab, nocons wrap cells(b(fmt(2)) se(par fmt(2)) p(fmt(2))) collabel(none) label stats(r2 N, fmt(2 0) labels("R^2" "N"))

unique jcode